Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
JSON: How do i access "event" here so that i send it to a JOI middleware

So i have this JSON object:

{
    "event": [
        {
        "nombre_organizador": "A",
        "celular_organizador_secundario": "1234567891",
        "nombre_evento": "Torneo de comer"
        }
    ],
    "ticket":[
    {
        "nombre": "Boleto platino",
        "cantidad": null
    }
]
}

But i can't figure out how to only acces the event part using this validateSchema code, i am currenly writing it as:

export const validateCreateEvent = async (req, res, next) => {
  const { event } = req
  const validation = await validateSchema(createEventSchema, event)
  if (validation.err) {
    res.status(400).json({ msg: validation.err })
    console.log(event)
    return
  }
  next()
}

It returns the sql querie error as:

sql: "insert into `eventos` (`event`, `ticket`) values ('[object Object]', '[object Object]')"

And if i write the const as { event } = req.body is says its an invalid object

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

already solved, all i had to do was delete the square bracket within my JSON lmao

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda